<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="d1"></div>
</body>
</html>
<script>
    // 数组格式
    let array = ['a', 'b', 'c', 'd'] // 普通数组，不是JSON格式
    // JSON格式
    let json = [
        {
            "id": "1",
            "name": "张三",
            "age": "18",
        },
        {
            "id": "2",
            "name": "李四",
            "age": "18",
        },
        {
            "id": "3",
            "name": "王五",
            "age": "18",
        }
    ]
    let divObj = document.getElementById('d1');
    for (let i = 0; i < json.length; i++) {
        let spanObj = document.createElement('span');
        spanObj.innerHTML = json[i].id + ' ' + json[i].name + ' ' + json[i].age + '<br/>';
        divObj.appendChild(spanObj)
    }
</script>